package cn.com.yang.server.jetty;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 处理servlet
 * TODO
 * @author yangyijin
 * @since 2023年5月18日-上午11:07:19
 */
@SuppressWarnings("serial")
public class JettyServlet extends HttpServlet{
	private Logger logger = Logger.getLogger("JettyServlet");
	// Get请求的处理
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("contextPath()=>"+req.getContextPath());
		logger.info("contextPath()=>{}"+req.getContextPath());
		resp.setContentType("text/html");
		resp.setStatus(HttpServletResponse.SC_OK);
		resp.getWriter().print("<h1>hello from Servlet</h1>");
		super.doGet(req, resp);
	}
}
